﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>CMS - 后台管理系统</title>
	<link href="/resource/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
	<link href="/resource/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
	<link href="/resource/css/ionicons.min.css" rel="stylesheet" type="text/css" />
	<link href="/resource/css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="row">
	<div class="col-md-12">
		<h1 class="panel-heading">标签管理</h1>
		<!--breadcrumbs start -->
		<ul class="breadcrumb">
			<li><a href="/admin/dashboard/toIndex"><i class="fa fa-home"></i> 首页</a></li>
			<li class="active">标签管理</li>
		</ul>
		<!--breadcrumbs end -->
	</div>
</div>
<section class="panel">
	<div class="panel-body">
		<section class="panel" th:each="value,key : ${labels}">
			<header class="panel-heading">
				<p style="margin: 0;"><b th:text="${key.current.key}"></b></p>
			</header>
			<div class="panel-body">
				<h3 th:id="${item.id}" class="label-h3" th:each="item :${key.current.value}">
					<span th:class="'label '+${obj}" th:if="${iterStat.index} eq ${item.cls}" th:each="obj,iterStat:${classs}">
						<span th:text="${item.tagName}+| (${item.tagCount})|"></span>
							<a data-toggle="modal" th:class="'label-close'" th:tagname="${item.tagName}" th:onclick="javascript: confrimRemove(this.getAttribute('tagname'))">
								<i th:class="'fa fa-times'"></i>
							</a>
						</span>
					</span>
				</h3>
			</div>
		</section>
	</div>
</section>
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="remove-dialog" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title">操作提示？</h4>
            </div>
            <div class="modal-body">
				<h4 class="modal-title">您确定要删除该记录吗？</h4>
				<input type="hidden" id="cacheID" />
            </div>
            <div class="modal-footer">
            	<button type="button" class="btn btn-primary btn-addon btn-sm" onclick="remove();">确定</button>
            	<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!-- jQuery 2.0.2 -->
<script src="/resource/js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="/resource/js/bootstrap.min.js"></script>
<script>
	function confrimRemove(id){
		$("#remove-dialog").modal();
		$("#cacheID").val(id);
	}
	
	function remove(){
		var current = $("#cacheID").val();
		window.location.href="/admin/label/delete?tagName="+current;
		$("#remove-dialog").modal('hide');
	}
</script>
</body>
</html>
